﻿using System;
using System.Web.Security;
using Servicios.Business.Modulos.Session;
using Servicios.Business.Proveedores;

public partial class Login : System.Web.UI.Page
{
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        var c = new BibliotecaMembershipProvider();
        if (c.ValidateUser(this.txtUsuario.Text, this.txtPassword.Text))
        {
            FormsAuthentication.SetAuthCookie(txtUsuario.Text, false);
            UsuariosPortalProvider userProv = new UsuariosPortalProvider();
            userProv.Session = userProv.GetSessionEntity(this.txtUsuario.Text, this.txtPassword.Text);
            Response.Redirect(Request["ReturnUrl"]);
        }
        else
            this.lblMensaje.Text = "Usuario no registrado!";
    }
}
